import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, MinLength, IsEmail, MaxLength } from 'class-validator';
export class RegisterUserDto {
  @ApiProperty({ description: '用户名', required: true })
  @IsNotEmpty({
    message: '用户名不能为空',
  })
  username: string;

  @ApiProperty({ description: '密码', required: true })
  @IsNotEmpty({
    message: '密码不能为空',
  })
  @MinLength(6, {
    message: '密码不能少于6位',
  })
  password: string;

  @ApiProperty({ description: '昵称', required: false })
  nickName: string;

  @ApiProperty({ description: '邮箱', required: true })
  @IsNotEmpty({
    message: '邮箱不能为空',
  })
  @IsEmail(
    {},
    {
      message: '不是合法的邮箱格式',
    },
  )
  email: string;

  @ApiProperty({ description: '电话', required: true })
  @IsNotEmpty({
    message: '手机不能为空',
  })
  phone: string;

  @ApiProperty({ description: '邮箱验证码', required: true })
  @IsNotEmpty({
    message: '邮箱验证码不能为空',
  })
  @MaxLength(6, {
    message: '邮箱验证码最大6位',
  })
  emailCode: string;
}
